import { onMounted, reactive } from "vue";
import axios, { AxiosError } from "axios";

export default function () {
    let dogList = reactive<string[]>([]);

    async function getDog() {
        try {
            let { data } = await axios.get('https://dog.ceo/api/breed/pembroke/images/random')
            dogList.push(data.message)
        } catch (ex) {
            const er=<AxiosError>ex
            console.log(er.message)
        }
    }

    onMounted(()=>{
        getDog()
    })

    return {dogList,getDog}
}